/**
 * Project Name:talkweb-cloud-datasource
 * File Name:DruidDataSourceFactory2.java
 * Package Name:com.talkweb.cloud.datasource
 * Date:2017年8月17日下午3:25:22
 * Copyright (c) 2017, jiazhijie@talkweb.com.cn All Rights Reserved.
 *
*/

package com.talkweb.cloud.datasource;

import javax.sql.DataSource;

import org.springframework.beans.BeanUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.alibaba.druid.pool.DruidDataSource;

/**
 * ClassName:DruidDataSourceFactory2 <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2017年8月17日 下午3:25:22 <br/>
 * @author   KOKO
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
@Configuration
public class DruidDataSourceFactory2 {

    
    /**
     * 把 spring.datasource下的所有属性值按setter注入方式全部注入到DruidDataSource实例中
     * @author KOKO
     * @return DataSource
     */
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource dataSource(){
        return BeanUtils.instantiate(DruidDataSource.class);
    }
}

